﻿using System;
using GeoAPI.Geometries;

namespace NetTopologySuite.Geometries
{
	public class TopologyException : ApplicationException
	{
		private static string MsgWithCoord(string msg, Coordinate pt)
		{
			if (pt != null)
			{
				return string.Concat(new object[]
				{
					msg,
					" [ ",
					pt,
					" ]"
				});
			}
			return msg;
		}

		public TopologyException(string msg) : base(msg)
		{
		}

		public TopologyException(string msg, Coordinate pt) : base(TopologyException.MsgWithCoord(msg, pt))
		{
			this.pt = new Coordinate(pt);
		}

		public Coordinate Coordinate
		{
			get
			{
				return this.pt;
			}
		}

		private readonly Coordinate pt;
	}
}
